package com.usian.controller;

import com.usian.pojo.User;
import com.usian.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
public class UserController {

    @Autowired
    UserService userService;

    @RequestMapping("findAll")
    public List<User> findAll(){
        System.out.println("findAll");
        return userService.findAll();
    }

    @RequestMapping("findById/{id}")
    public User findById(@PathVariable Integer id){

        return userService.findById(id);
    }

    @RequestMapping("findName")
    public User findName(@RequestParam String name){

        return userService.findName(name);
    }

    @RequestMapping("findUser")
    public void findUser(@RequestBody User user){
        System.out.println(user);
    }

}
